/******************** 变量 ********************/
$lv-color-picker-white-bg-color: #ffffff;
$lv-color-picker-black-bg-color: #000000;
$lv-color-picker-red-bg-color: #ff0000;
$lv-color-picker-yellow-bg-color: #ffff00;
$lv-color-picker-green-bg-color: #00ff00;
$lv-color-picker-cyan-bg-color: #00ffff;
$lv-color-picker-blue-bg-color: #0000ff;
$lv-color-picker-purple-bg-color: #ff00ff;
$lv-color-picker-hue-handle-bg-color: #ffffff;
$lv-color-picker-white-border-color: #ffffff;
$lv-color-picker-white-transparent-bg-color: rgba($lv-color-picker-white-bg-color, 0);
$lv-color-picker-colourless-bg-color: rgba($lv-color-picker-black-bg-color, 0);
$lv-color-picker-black-box-shadow-color: rgba($lv-color-picker-black-bg-color, 0.5);

/******************** 组件 ********************/
.lv-color-picker-panel {
  &.lv-popover .lv-popover-inner {
    padding: $padding-sm;
  }

  .lv-popover-container {
    width: 2rem;
  }
}

.lv-color-picker-palette {
  position: relative;
  width: 1.85rem;
  height: 1.24rem;
  margin-bottom: $margin-sm;
  overflow: hidden;

  .lv-color-picker-palette-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 1.85rem;
    height: 1.24rem;

    > div {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }

    &-white {
      background: -webkit-gradient(
        linear,
        left top,
        right top,
        from($lv-color-picker-white-bg-color),
        to($lv-color-picker-white-transparent-bg-color)
      );
      background: linear-gradient(to right, $lv-color-picker-white-bg-color 0%, $lv-color-picker-white-transparent-bg-color 100%);
    }

    &-black {
      background: -webkit-gradient(
        linear,
        left top,
        left bottom,
        from($lv-color-picker-colourless-bg-color),
        to($lv-color-picker-black-bg-color)
      );
      background: linear-gradient(to bottom, $lv-color-picker-colourless-bg-color 0%, $lv-color-picker-black-bg-color 100%);
    }
  }

  .lv-color-picker-color {
    width: 1.85rem;
    height: 1.24rem;
  }

  .lv-color-picker-color-handle {
    position: absolute;
    top: 0;
    left: 1.85rem;
    width: 0.1rem;
    height: 0.1rem;
    margin: -0.05rem 0 0 -0.05rem;
    border: $border-width-base $border-style-base $lv-color-picker-white-border-color;
    border-radius: 100%;
    box-shadow: 0 0.02rem 0.04rem 0 $lv-color-picker-black-box-shadow-color;
    cursor: pointer;
  }
}

.lv-color-picker-hue {
  position: relative;
  width: 1.85rem;
  height: 0.1rem;

  .lv-color-picker-hue-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 1.85rem;
    height: 0.1rem;
    background: -webkit-linear-gradient(
      to left,
      $lv-color-picker-red-bg-color 0%,
      $lv-color-picker-yellow-bg-color 17%,
      $lv-color-picker-green-bg-color 33%,
      $lv-color-picker-cyan-bg-color 50%,
      $lv-color-picker-blue-bg-color 67%,
      $lv-color-picker-purple-bg-color 83%,
      $lv-color-picker-red-bg-color 100%
    );
    background: linear-gradient(
      to left,
      $lv-color-picker-red-bg-color 0%,
      $lv-color-picker-yellow-bg-color 17%,
      $lv-color-picker-green-bg-color 33%,
      $lv-color-picker-cyan-bg-color 50%,
      $lv-color-picker-blue-bg-color 67%,
      $lv-color-picker-purple-bg-color 83%,
      $lv-color-picker-red-bg-color 100%
    );
    border-radius: 0.05rem;
  }

  .lv-color-picker-hue-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 0.14rem;
    height: 0.14rem;
    margin-top: -0.02rem;
    margin-left: -$margin-sm;
    background: $lv-color-picker-hue-handle-bg-color;
    border-radius: 0.14rem;
    box-shadow: 0 0.01rem 0.05rem $lv-color-picker-black-box-shadow-color;
    cursor: pointer;
    opacity: 1;
  }
}

.lv-color-picker-text.lv-input.lv-input-size-default {
  width: 1.85rem;
  margin-top: $margin-sm;
}

.lv-unselectable-text {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -o-user-select: none;
  user-select: none;
}
